#!/bin/bash
\cp -f -b ./temp/linux_amd64/main  ../server-1/
chmod 777 ../server-1/main
ServerPID=$(lsof -i:8200 | grep LISTEN |awk '{print $2}')
echo "$ServerPID"
if [ "$ServerPID" == '' ];then
    echo "main server start"
    cd ../server-1/ || exit
    nohup ../server-1/main > ../server-1/nohup.out 2>&1 &
else
    echo "main server graceful"
    kill -SIGUSR1 $ServerPID
fi